<?php

return array(
    'router'             => array(
        'routes' => array(
            'lang'         => array(
                'type'    => 'Zend\Mvc\Router\Http\Segment',
                'options' => array(
                    'route'       => '/[:alias]',
                    'constraints' => array(
                        'alias' => '[a-z]{2}',
                    ),
                    'defaults'    => array(
                        'controller' => 'App\Controller\Language',
                        'action'     => 'index'
                    ),
                ),
            ),
            'admin'         => array(
                'type'    => 'Zend\Mvc\Router\Http\Literal',
                'options' => array(
                    'route'    => '/root',
                    'defaults' => array(
                        'controller' => 'App\Controller\Admin',
                        'action'     => 'index',
                    ),
                ),
            ),
            'root'         => array(
                'type'    => 'Zend\Mvc\Router\Http\Literal',
                'options' => array(
                    'route'    => '/',
                    'defaults' => array(
                        'controller' => 'App\Controller\Index',
                        'action'     => 'index',
                    ),
                ),
            ),
            'job'          => array(
                'type'          => 'Zend\Mvc\Router\Http\Literal',
                'options'       => array(
                    'route'    => '/job',
                    'defaults' => array(
                        'controller' => 'App\Controller\Job',
                        'action'     => 'index'
                    ),
                ),
                'may_terminate' => true,
                'child_routes'  => array(
                    // Segment route for viewing one blog post
                    'page' => array(
                        'type'    => 'segment',
                        'options' => array(
                            'route'       => '/[:title].[:hash].html',
                            'constraints' => array(
                                'title' => '[a-zA-Z0-9-]+',
                                'hash'  => '[A-Z]+'
                            )
                        )
                    ),
                )
            ),
            'skill'        => array(
                'type'    => 'Zend\Mvc\Router\Http\Segment',
                'options' => array(
                    'route'    => '/skill',
                    'defaults' => array(
                        'controller' => 'App\Controller\Skill',
                        'action'     => 'index'
                    ),
                ),
            ),
            'page'         => array(
                'type'    => 'Zend\Mvc\Router\Http\Segment',
                'options' => array(
                    'route'    => '/page/:alias',
                    'defaults' => array(
                        'controller'  => 'App\Controller\Organization',
                        'constraints' => array(
                            'alias' => '[a-z_]+'
                        ),
                        'action'      => 'index'
                    ),
                ),
            ),
            'app'          => array(
                'type'          => 'Zend\Mvc\Router\Http\Literal',
                'options'       => array(
                    'route'    => '/app',
                    'defaults' => array(
                        'controller' => 'App\Controller\App',
                        'action'     => 'index'
                    ),
                ),
                'may_terminate' => true,
                'child_routes'  => array(
                    // Segment route for viewing one blog post
                    'page' => array(
                        'type'    => 'segment',
                        'options' => array(
                            'route'       => '/[:action]',
                            'constraints' => array(
                                'action' => '[a-z]+'
                            )
                        )
                    ),
                )
            ),
            'res'          => array(
                'type'          => 'Zend\Mvc\Router\Http\Literal',
                'options'       => array(
                    'route'    => '/res',
                    'defaults' => array(
                        'controller' => 'App\Controller\Resource',
                        'action'     => 'index'
                    ),
                ),
                'may_terminate' => true,
                'child_routes'  => array(
                    // Segment route for viewing one blog post
                    'page' => array(
                        'type'    => 'segment',
                        'options' => array(
                            'route'       => '/[:action]/[:files]',
                            'constraints' => array(
                                'action' => 'css|js',
                                'files'  => '[a-z.-]+'
                            )
                        )
                    ),
                )
            ),
            'ajax'         => array(
                'type'          => 'Zend\Mvc\Router\Http\Literal',
                'options'       => array(
                    'route'    => '/syn',
                    'defaults' => array(
                        'controller' => 'App\Controller\Ajax',
                        'action'     => 'index'
                    ),
                ),
                'may_terminate' => true,
                'child_routes'  => array(
                    'page' => array(
                        'type'    => 'segment',
                        'options' => array(
                            'route'       => '/:action',
                            'constraints' => array(
                                'alias' => '[a-z_]+'
                            ),
                        )
                    ),
                )
            ),
            'user'         => array(
                'type'    => 'Zend\Mvc\Router\Http\Segment',
                'options' => array(
                    'route'       => '/u/:id',
                    'constraints' => array(
                        'id' => '[0-9]{1,30}'
                    ),
                    'defaults'    => array(
                        'controller' => 'App\Controller\User',
                        'action'     => 'index'
                    ),
                ),
            ),
            'organization' => array(
                'type'    => 'Zend\Mvc\Router\Http\Segment',
                'options' => array(
                    'route'       => '/o/:id',
                    'constraints' => array(
                        'id' => '[0-9]{1,30}'
                    ),
                    'defaults'    => array(
                        'controller' => 'App\Controller\Organization',
                        'action'     => 'index'
                    ),
                ),
            ),
            'alias'       => array(
                'type'    => 'Zend\Mvc\Router\Http\Segment',
                'options' => array(
                    'route'       => '/:alias',
                    'constraints' => array(
                        'alias' => '[a-z]{1}[a-z0-9._-]{4,29}'
                    ),
                    'defaults'    => array(
                        'controller' => 'App\Controller\Alias',
                        'action'     => 'index'
                    ),
                ),
            ),
        ),
    ),
    'service_manager'    => array(
        'abstract_factories' => array(
            'Zend\Cache\Service\StorageCacheAbstractServiceFactory',
            'Zend\Log\LoggerAbstractServiceFactory',
        ),
        'aliases'            => array(
            'translator' => 'MvcTranslator',
        ),
    ),
    'translator'         => array(
        'locale'                    => 'en-US',
        'translation_file_patterns' => array(
            array(
                'type'     => 'gettext',
                'base_dir' => __DIR__ . '/../language',
                'pattern'  => '%s.mo',
            ),
        ),
    ),

    'controllers'        => array(
        'invokables' => array(
            'App\Controller\Admin'        => 'App\Controller\AdminController',
            'App\Controller\Alias'        => 'App\Controller\AliasController',
            'App\Controller\Index'        => 'App\Controller\IndexController',
            'App\Controller\App'          => 'App\Controller\AppController',
            'App\Controller\User'         => 'App\Controller\UserController',
            'App\Controller\Ajax'         => 'App\Controller\AjaxController',
            'App\Controller\Job'          => 'App\Controller\JobController',
            'App\Controller\Language'     => 'App\Controller\LanguageController',
            'App\Controller\Remote'       => 'App\Controller\RemoteController',
            'App\Controller\Resource'     => 'App\Controller\ResourceController',
            'App\Controller\Organization' => 'App\Controller\OrganizationController',
            'App\Controller\Skill'        => 'App\Controller\SkillController',
            'App\Controller\Tag'          => 'App\Controller\TagController',
        ),
    ),

    'view_manager'       => array(
        'display_not_found_reason' => true,
        'display_exceptions'       => true,
        'doctype'                  => 'HTML5',
        'not_found_template'       => 'error/404',
        'exception_template'       => 'error/index',
        'template_map'             => array(
            'layout/layout' => __DIR__ . '/../view/layout/layout.phtml',
            'error/404'     => __DIR__ . '/../view/error/404.phtml',
            'error/index'   => __DIR__ . '/../view/error/index.phtml',
        ),
        'template_path_stack'      => array(
            __DIR__ . '/../view',
        ),
        'strategies'               => array(
            'ViewJsonStrategy',
        ),
    ),
    'controller_plugins' => array(
        'factories' => array(
            'translate' => 'App\Controller\Plugin\Translate',
        ),
    ),
);
